package com.aboverock.common.enums;

/**
 * The Enum LogTypeEnum.
 *
 * @author Rock Wang
 */
public enum LogTypeEnum {

    /** 登录日志(0). */
    LOGIN(0, "{\"zh\":\"登录\",\"en\":\"login\"}"),

    /** 安全日志(1). */
    SECURITY(1, "{\"zh\":\"安全\",\"en\":\"security\"}"),

    /** 异常日志(2). */
    EXCEPTION(2, "{\"zh\":\"异常\",\"en\":\"exception\"}"),

    /** 定时任务日志(3). */
    TIMEDTASK(3, "{\"zh\":\"定时任务\",\"en\":\"timed task\"}");

    /** The value. */
    private final Integer value;

    /** 描述 String型. */
    private final String description;

    /**
     * Instantiates a new log type enum.
     *
     * @param value the value
     * @param description the description
     */
    LogTypeEnum(Integer value, String description) {
        this.value = value;
        this.description = description;
    }

    /**
     * 获取值.
     *
     * @return value
     */
    public Integer getValue() {
        return value;
    }

    /**
     * 获取描述信息.
     *
     * @return description
     */
    public String getDescription() {
        return description;
    }

    /**
     * Gets the log type.
     *
     * @param value the value
     * @return the log type
     */
    public static LogTypeEnum getLogType(Integer value) {
        if (null == value) {
            return null;
        }

        for (LogTypeEnum logType : LogTypeEnum.values()) {
            if (value.equals(logType.getValue())) {
                return logType;
            }
        }
        return null;
    }

}